﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Xml.Serialization;
using System.Linq;
using System.Text;
using FrameworkManapro.BusinessModel;

namespace GMAC.ReportingSystem.Business.Components
{
    public class ProductComponent : IBusinessComponent<Entities.Product>
    {
        private DataAccess.ProductDataAccess dac;

        public ProductComponent()
        {
            dac = new GMAC.ReportingSystem.DataAccess.ProductDataAccess();
        }

        #region IBusinessComponent<Product> Members

        public int Create(GMAC.ReportingSystem.Business.Entities.Product entityToCreate)
        {
            throw new NotImplementedException();
        }

        public int Delete(GMAC.ReportingSystem.Business.Entities.Product entityToDelete)
        {
            throw new NotImplementedException();
        }

        public int Edit(GMAC.ReportingSystem.Business.Entities.Product entityToEdit)
        {
            throw new NotImplementedException();
        }

        public GMAC.ReportingSystem.Business.Entities.Product GetDetails(object entityId)
        {
            return dac.Get(entityId);
        }

        //private bool Validate(Entities.Product Product)
        //{
        //    if (Product == null) throw new ArgumentNullException("Product", "The argument cannot be null.");
        //    return true;
        //}

        #endregion              

        //public Entities.ProductCollection Search(string ProductName, string ProductCode)
        //{
        //    if (ProductName == null) ProductName = string.Empty;
        //    if (ProductCode == null) ProductCode = string.Empty;

        //    return dac.Search(ProductName, ProductCode);
        //}

        public Entities.ProductCollection GetList()
        {
            return dac.GetList();
        }
        public Entities.Product Get(object id)
        {
            return dac.Get(id);
        }
        //public Entities.ProductCollection GetbyCode(string code)
        //{
        //    return dac.GetbyCode(code);
        //}
    }
}
